using OracleInternal.I18N;

namespace OracleInternal.Network
{
	internal class RedirectPacket : Packet
	{
		internal string redirectAddress;

		internal string redirectConnectData;

		internal RedirectPacket(Packet pkt)
			: base(pkt)
		{
			m_dataOffset = TNSPacketOffsets.NSPRDDAT;
			m_dataLength = m_dataBuffer[TNSPacketOffsets.NSPRDLEN] & 0xFF;
			m_dataLength <<= 8;
			m_dataLength |= m_dataBuffer[TNSPacketOffsets.NSPRDLEN + 1] & 0xFF;
			byte[] bytes = ExtractData();
			redirectAddress = Conv.GetInstance(871).ConvertBytesToString(bytes, 0, m_dataLength);
			if ((m_flags & Packet.NSPFRDS) > 0)
			{
				int num = redirectAddress.IndexOf('\0');
				if (num > 0)
				{
					redirectConnectData = redirectAddress.Substring(num + 1, redirectAddress.Length - num - 1);
					redirectAddress = redirectAddress.Substring(0, num);
				}
			}
		}
	}
}
